home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / zaxxon.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  40KB  |  1,050 lines

  1. /***************************************************************************
  2.  
  3. Notes:
  4.  
  5. - the duck season in razmataz is controlled by ff3c, maybe a timer. When it's
  6.   0, it ends. We are currently returning 0xff so it never ends unitl you shoot
  7.   stop.
  8.  
  9.  
  10. Zaxxon memory map (preliminary)
  11.  
  12. 0000-1fff ROM 3
  13. 2000-3fff ROM 2
  14. 4000-4fff ROM 1
  15. 6000-67ff RAM 1
  16. 6800-6fff RAM 2
  17. 8000-83ff Video RAM
  18. a000-a0ff sprites
  19.  
  20. read:
  21. c000      IN0
  22. c001      IN1
  23. c002      DSW0
  24. c003      DSW1
  25. c100      IN2
  26. see the input_ports definition below for details on the input bits
  27.  
  28. write:
  29. c000      coin A enable
  30. c001      coin B enable
  31. c002      coin aux enable
  32. c003-c004 coin counters
  33. c006      flip screen
  34. ff3c-ff3f sound (see below)
  35. fff0      interrupt enable
  36. fff1      character color bank (not used during the game, but used in test mode)
  37. fff8-fff9 background playfield position (11 bits)
  38. fffa      background color bank (0 = standard  1 = reddish)
  39. fffb      background enable
  40.  
  41. interrupts:
  42. VBlank triggers IRQ, handled with interrupt mode 1
  43. NMI enters the test mode.
  44.  
  45. Changes:
  46. 25 Jan 98 LBO
  47.     * Added crude support for samples based on Frank's info. As of yet, I don't have
  48.       a set that matches the names - I need a way to edit the .wav files I have.
  49.       Hopefully I'll be able to create a good set shortly. I also don't know which
  50.       sounds "loop".
  51. 26 Jan 98 LBO
  52.     * Fixed the sound support. I lack explosion samples and the base missile sample so
  53.       these are untested. I'm also unsure about the background noise. It seems to have
  54.       a variable volume so I've tried to reproduce that via just 1 sample.
  55.  
  56. 12 Mar 98 ATJ
  57.         * For the moment replaced Brad's version of the samples with mine from the Mame/P
  58.           release. As yet, no variable volume, but I will be combining the features from
  59.           Brad's driver into mine ASAP.
  60.  
  61. ***************************************************************************/
  62.  
  63. #include "driver.h"
  64. #include "vidhrdw/generic.h"
  65.  
  66.  
  67.  
  68. READ_HANDLER( zaxxon_IN2_r );
  69.  
  70. extern unsigned char *zaxxon_char_color_bank;
  71. extern unsigned char *zaxxon_background_position;
  72. extern unsigned char *zaxxon_background_color_bank;
  73. extern unsigned char *zaxxon_background_enable;
  74. void zaxxon_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  75. int  zaxxon_vh_start(void);
  76. int  razmataz_vh_start(void);
  77. void zaxxon_vh_stop(void);
  78. void zaxxon_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  79. void razmataz_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  80. extern int zaxxon_vid_type;
  81.  
  82. WRITE_HANDLER( zaxxon_sound_w );
  83.  
  84. /* in machine/segacrpt.c */
  85. void szaxxon_decode(void);
  86. void nprinces_decode(void);
  87. void futspy_decode(void);
  88.  
  89.  
  90.  
  91. void zaxxon_init_machine(void)
  92. {
  93.     zaxxon_vid_type = 0;
  94. }
  95.  
  96. void futspy_init_machine(void)
  97. {
  98.     zaxxon_vid_type = 2;
  99. }
  100.  
  101. static READ_HANDLER( razmataz_unknown1_r )
  102. {
  103.     return rand() & 0xff;
  104. }
  105.  
  106. static READ_HANDLER( razmataz_unknown2_r )
  107. {
  108.     return 0xff;
  109. }
  110.  
  111. static int razmataz_dial_r(int num)
  112. {
  113.     static unsigned char pos[2];
  114.     int delta,res;
  115.  
  116.     delta = readinputport(num);
  117.  
  118.     if (delta < 0x80)
  119.     {
  120.         /* right */
  121.         pos[num] -= delta;
  122.         res = (pos[num] << 1) | 1;
  123.     }
  124.     else
  125.     {
  126.         /* left */
  127.         pos[num] += delta;
  128.         res = (pos[num] << 1);
  129.     }
  130.  
  131.     return res;
  132. }
  133.  
  134. static READ_HANDLER( razmataz_dial_0_r )
  135. {
  136.     return razmataz_dial_r(0);
  137. }
  138.  
  139. static READ_HANDLER( razmataz_dial_1_r )
  140. {
  141.     return razmataz_dial_r(1);
  142. }
  143.  
  144.  
  145.  
  146. static struct MemoryReadAddress readmem[] =
  147. {
  148.     { 0x0000, 0x4fff, MRA_ROM },
  149.     { 0x6000, 0x6fff, MRA_RAM },
  150.     { 0x8000, 0x83ff, MRA_RAM },
  151.     { 0xa000, 0xa0ff, MRA_RAM },
  152.     { 0xc000, 0xc000, input_port_0_r },    /* IN0 */
  153.     { 0xc001, 0xc001, input_port_1_r },    /* IN1 */
  154.     { 0xc002, 0xc002, input_port_3_r },    /* DSW0 */
  155.     { 0xc003, 0xc003, input_port_4_r },    /* DSW1 */
  156.     { 0xc100, 0xc100, input_port_2_r },    /* IN2 */
  157.     { -1 }  /* end of table */
  158. };
  159.  
  160. static struct MemoryWriteAddress writemem[] =
  161. {
  162.     { 0x0000, 0x4fff, MWA_ROM },
  163.     { 0x6000, 0x6fff, MWA_RAM },
  164.     { 0x8000, 0x83ff, videoram_w, &videoram, &videoram_size },
  165.     { 0xa000, 0xa0ff, MWA_RAM, &spriteram, &spriteram_size },
  166.     { 0xc000, 0xc002, MWA_NOP },    /* coin enables */
  167.     { 0xc003, 0xc004, coin_counter_w },
  168.     { 0xff3c, 0xff3e, zaxxon_sound_w },
  169.     { 0xfff0, 0xfff0, interrupt_enable_w },
  170.     { 0xfff1, 0xfff1, MWA_RAM, &zaxxon_char_color_bank },
  171.     { 0xfff8, 0xfff9, MWA_RAM, &zaxxon_background_position },
  172.     { 0xfffa, 0xfffa, MWA_RAM, &zaxxon_background_color_bank },
  173.     { 0xfffb, 0xfffb, MWA_RAM, &zaxxon_background_enable },
  174.     { -1 }  /* end of table */
  175. };
  176.  
  177. static struct MemoryWriteAddress futspy_writemem[] =
  178. {
  179.     { 0x0000, 0x4fff, MWA_ROM },
  180.     { 0x6000, 0x6fff, MWA_RAM },
  181.     { 0x8000, 0x83ff, videoram_w, &videoram, &videoram_size },
  182.     { 0xa000, 0xa0ff, MWA_RAM, &spriteram, &spriteram_size },
  183.     { 0xc000, 0xc002, MWA_NOP },    /* coin enables */
  184.     { 0xe03c, 0xe03e, zaxxon_sound_w },
  185.     { 0xe0f0, 0xe0f0, interrupt_enable_w },
  186.     { 0xe0f1, 0xe0f1, MWA_RAM, &zaxxon_char_color_bank },
  187.     { 0xe0f8, 0xe0f9, MWA_RAM, &zaxxon_background_position },
  188.     { 0xe0fa, 0xe0fa, MWA_RAM, &zaxxon_background_color_bank },
  189.     { 0xe0fb, 0xe0fb, MWA_RAM, &zaxxon_background_enable },
  190.     { -1 }  /* end of table */
  191. };
  192.  
  193.  
  194. static struct MemoryReadAddress razmataz_readmem[] =
  195. {
  196.     { 0x0000, 0x5fff, MRA_ROM },
  197.     { 0x6000, 0x6fff, MRA_RAM },
  198.     { 0x8000, 0x83ff, MRA_RAM },
  199.     { 0xa000, 0xa0ff, MRA_RAM },
  200.     { 0xc000, 0xc000, razmataz_dial_0_r },    /* dial pl 1 */
  201.     { 0xc002, 0xc002, input_port_3_r },    /* DSW0 */
  202.     { 0xc003, 0xc003, input_port_4_r },    /* DSW1 */
  203.     { 0xc004, 0xc004, input_port_6_r },    /* fire/start pl 1 */
  204.     { 0xc008, 0xc008, razmataz_dial_1_r },    /* dial pl 2 */
  205.     { 0xc00c, 0xc00c, input_port_7_r },    /* fire/start pl 2 */
  206.     { 0xc100, 0xc100, input_port_2_r },    /* coin */
  207.     { 0xc80a, 0xc80a, razmataz_unknown1_r },    /* needed, otherwise the game hangs */
  208.     { 0xff3c, 0xff3c, razmataz_unknown2_r },    /* timer? if 0, "duck season" ends */
  209.     { -1 }  /* end of table */
  210. };
  211.  
  212. static struct MemoryWriteAddress razmataz_writemem[] =
  213. {
  214.     { 0x0000, 0x5fff, MWA_ROM },
  215.     { 0x6000, 0x6fff, MWA_RAM },
  216.     { 0x8000, 0x83ff, videoram_w, &videoram, &videoram_size },
  217.     { 0xa000, 0xa0ff, MWA_RAM, &spriteram, &spriteram_size },
  218.     { 0xc000, 0xc002, MWA_NOP },    /* coin enables */
  219.     { 0xc003, 0xc004, coin_counter_w },
  220.     { 0xe0f0, 0xe0f0, interrupt_enable_w },
  221.     { 0xe0f1, 0xe0f1, MWA_RAM, &zaxxon_char_color_bank },
  222.     { 0xe0f8, 0xe0f9, MWA_RAM, &zaxxon_background_position },
  223.     { 0xe0fa, 0xe0fa, MWA_RAM, &zaxxon_background_color_bank },
  224.     { 0xe0fb, 0xe0fb, MWA_RAM, &zaxxon_background_enable },
  225. //    { 0xff3c, 0xff3c, }, sound
  226.     { -1 }  /* end of table */
  227. };
  228.  
  229.  
  230. /***************************************************************************
  231.  
  232.   Zaxxon uses NMI to trigger the self test. We use a fake input port to
  233.   tie that event to a keypress.
  234.  
  235. ***************************************************************************/
  236.  
  237. static int zaxxon_interrupt(void)
  238. {
  239.     if (readinputport(5) & 1)    /* get status of the F2 key */
  240.         return nmi_interrupt();    /* trigger self test */
  241.     else return interrupt();
  242. }
  243.  
  244. INPUT_PORTS_START( zaxxon )
  245.     PORT_START    /* IN0 */
  246.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  247.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_8WAY )
  248.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_8WAY )    /* the self test calls this UP */
  249.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_8WAY )    /* the self test calls this DOWN */
  250.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  251.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )    /* button 2 - unused */
  252.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
  253.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
  254.  
  255.     PORT_START    /* IN1 */
  256.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  257.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
  258.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )    /* the self test calls this UP */
  259.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )    /* the self test calls this DOWN */
  260.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
  261.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )    /* button 2 - unused */
  262.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
  263.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
  264.  
  265.     PORT_START    /* IN2 */
  266.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
  267.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
  268.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
  269.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )
  270.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )
  271.     /* the coin inputs must stay active for exactly one frame, otherwise */
  272.     /* the game will keep inserting coins. */
  273.     PORT_BIT_IMPULSE( 0x20, IP_ACTIVE_HIGH, IPT_COIN1, 1 )
  274.     PORT_BIT_IMPULSE( 0x40, IP_ACTIVE_HIGH, IPT_COIN2, 1 )
  275.     PORT_BIT_IMPULSE( 0x80, IP_ACTIVE_HIGH, IPT_COIN3, 1 )
  276.  
  277.     PORT_START    /* DSW0 */
  278.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Bonus_Life ) )
  279.     PORT_DIPSETTING(    0x03, "10000" )
  280.     PORT_DIPSETTING(    0x01, "20000" )
  281.     PORT_DIPSETTING(    0x02, "30000" )
  282.     PORT_DIPSETTING(    0x00, "40000" )
  283.     /* The Super Zaxxon manual lists the following as unused. */
  284.     PORT_DIPNAME( 0x0c, 0x0c, "Difficulty???" )
  285.     PORT_DIPSETTING(    0x0c, "Easy?" )
  286.     PORT_DIPSETTING(    0x04, "Medium?" )
  287.     PORT_DIPSETTING(    0x08, "Hard?" )
  288.     PORT_DIPSETTING(    0x00, "Hardest?" )
  289.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
  290.     PORT_DIPSETTING(    0x30, "3" )
  291.     PORT_DIPSETTING(    0x10, "4" )
  292.     PORT_DIPSETTING(    0x20, "5" )
  293.     PORT_BITX( 0,       0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "Infinite", IP_KEY_NONE, IP_JOY_NONE )
  294.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Demo_Sounds ) )
  295.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  296.     PORT_DIPSETTING(    0x40, DEF_STR( On ) )
  297.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Cabinet ) )
  298.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  299.     PORT_DIPSETTING(    0x80, DEF_STR( Cocktail ) )
  300.  
  301.     PORT_START    /* DSW1 */
  302.     PORT_DIPNAME( 0x0f, 0x03, DEF_STR ( Coin_B ) )
  303.     PORT_DIPSETTING(    0x0f, DEF_STR ( 4C_1C ) )
  304.     PORT_DIPSETTING(    0x07, DEF_STR ( 3C_1C ) )
  305.     PORT_DIPSETTING(    0x0b, DEF_STR ( 2C_1C ) )
  306.     PORT_DIPSETTING(    0x06, "2 Coins/1 Credit 5/3 6/4" )
  307.     PORT_DIPSETTING(    0x0a, "2 Coins/1 Credit 3/2 4/3" )
  308.     PORT_DIPSETTING(    0x03, DEF_STR ( 1C_1C ) )
  309.     PORT_DIPSETTING(    0x02, "1 Coin/1 Credit 5/6" )
  310.     PORT_DIPSETTING(    0x0c, "1 Coin/1 Credit 4/5" )
  311.     PORT_DIPSETTING(    0x04, "1 Coin/1 Credit 2/3" )
  312.     PORT_DIPSETTING(    0x0d, DEF_STR ( 1C_2C ) )
  313.     PORT_DIPSETTING(    0x08, "1 Coin/2 Credits 5/11" )
  314.     PORT_DIPSETTING(    0x00, "1 Coin/2 Credits 4/9" )
  315.     PORT_DIPSETTING(    0x05, DEF_STR ( 1C_3C ) )
  316.     PORT_DIPSETTING(    0x09, DEF_STR ( 1C_4C ) )
  317.     PORT_DIPSETTING(    0x01, DEF_STR ( 1C_5C ) )
  318.     PORT_DIPSETTING(    0x0e, DEF_STR ( 1C_6C ) )
  319.     PORT_DIPNAME( 0xf0, 0x30, DEF_STR ( Coin_A ) )
  320.     PORT_DIPSETTING(    0xf0, DEF_STR ( 4C_1C ) )
  321.     PORT_DIPSETTING(    0x70, DEF_STR ( 3C_1C ) )
  322.     PORT_DIPSETTING(    0xb0, DEF_STR ( 2C_1C ) )
  323.     PORT_DIPSETTING(    0x60, "2 Coins/1 Credit 5/3 6/4" )
  324.     PORT_DIPSETTING(    0xa0, "2 Coins/1 Credit 3/2 4/3" )
  325.     PORT_DIPSETTING(    0x30, DEF_STR ( 1C_1C ) )
  326.     PORT_DIPSETTING(    0x20, "1 Coin/1 Credit 5/6" )
  327.     PORT_DIPSETTING(    0xc0, "1 Coin/1 Credit 4/5" )
  328.     PORT_DIPSETTING(    0x40, "1 Coin/1 Credit 2/3" )
  329.     PORT_DIPSETTING(    0xd0, DEF_STR ( 1C_2C ) )
  330.     PORT_DIPSETTING(    0x80, "1 Coin/2 Credits 5/11" )
  331.     PORT_DIPSETTING(    0x00, "1 Coin/2 Credits 4/9" )
  332.     PORT_DIPSETTING(    0x50, DEF_STR ( 1C_3C ) )
  333.     PORT_DIPSETTING(    0x90, DEF_STR ( 1C_4C ) )
  334.     PORT_DIPSETTING(    0x10, DEF_STR ( 1C_5C ) )
  335.     PORT_DIPSETTING(    0xe0, DEF_STR ( 1C_6C ) )
  336.  
  337.     PORT_START    /* FAKE */
  338.     /* This fake input port is used to get the status of the F2 key, */
  339.     /* and activate the test mode, which is triggered by a NMI */
  340.     PORT_BITX(0x01, IP_ACTIVE_HIGH, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
  341. INPUT_PORTS_END
  342.  
  343. INPUT_PORTS_START( futspy )
  344.     PORT_START    /* IN0 */
  345.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  346.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_8WAY )
  347.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_8WAY )    /* the self test calls this UP */
  348.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_8WAY )    /* the self test calls this DOWN */
  349.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  350.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 )
  351.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
  352.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
  353.  
  354.     PORT_START    /* IN1 */
  355.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  356.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
  357.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )    /* the self test calls this UP */
  358.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )    /* the self test calls this DOWN */
  359.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
  360.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 | IPF_COCKTAIL )
  361.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
  362.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
  363.  
  364.     PORT_START    /* IN2 */
  365.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
  366.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
  367.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
  368.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )
  369.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )
  370.     /* the coin inputs must stay active for exactly one frame, otherwise */
  371.     /* the game will keep inserting coins. */
  372.     PORT_BIT_IMPULSE( 0x20, IP_ACTIVE_HIGH, IPT_COIN1, 1 )
  373.     PORT_BIT_IMPULSE( 0x40, IP_ACTIVE_HIGH, IPT_COIN2, 1 )
  374.     PORT_BIT_IMPULSE( 0x80, IP_ACTIVE_HIGH, IPT_COIN3, 1 )
  375.  
  376.     PORT_START    /* DSW1 */
  377.     PORT_DIPNAME( 0x0f, 0x00, DEF_STR ( Coin_A ) )
  378.     PORT_DIPSETTING(    0x08, DEF_STR ( 4C_1C ) )
  379.     PORT_DIPSETTING(    0x07, DEF_STR ( 3C_1C ) )
  380.     PORT_DIPSETTING(    0x06, DEF_STR ( 2C_1C ) )
  381.     PORT_DIPSETTING(    0x0a, "2 Coins/1 Credit 5/3 6/4" )
  382.     PORT_DIPSETTING(    0x0b, "2 Coins/1 Credit 4/3" )
  383.     PORT_DIPSETTING(    0x00, DEF_STR ( 1C_1C ) )
  384.     PORT_DIPSETTING(    0x0e, "1 Coin/1 Credit 2/3" )
  385.     PORT_DIPSETTING(    0x0d, "1 Coin/1 Credit 4/5" )
  386.     PORT_DIPSETTING(    0x0c, "1 Coin/1 Credit 11/12" )
  387.     PORT_DIPSETTING(    0x09, DEF_STR ( 2C_3C ) )
  388.     PORT_DIPSETTING(    0x01, DEF_STR ( 1C_2C ) )
  389.     PORT_DIPSETTING(    0x0f, "1 Coin/2 Credits 5/11" )
  390.     PORT_DIPSETTING(    0x02, DEF_STR ( 1C_3C ) )
  391.     PORT_DIPSETTING(    0x03, DEF_STR ( 1C_4C ) )
  392.     PORT_DIPSETTING(    0x04, DEF_STR ( 1C_5C ) )
  393.     PORT_DIPSETTING(    0x05, DEF_STR ( 1C_6C ) )
  394.     PORT_DIPNAME( 0xf0, 0x00, DEF_STR ( Coin_B ) )
  395.     PORT_DIPSETTING(    0x80, DEF_STR ( 4C_1C ) )
  396.     PORT_DIPSETTING(    0x70, DEF_STR ( 3C_1C ) )
  397.     PORT_DIPSETTING(    0x60, DEF_STR ( 2C_1C ) )
  398.     PORT_DIPSETTING(    0xa0, "2 Coins/1 Credit 5/3 6/4" )
  399.     PORT_DIPSETTING(    0xb0, "2 Coins/1 Credit 4/3" )
  400.     PORT_DIPSETTING(    0x00, DEF_STR ( 1C_1C ) )
  401.     PORT_DIPSETTING(    0xe0, "1 Coin/1 Credit 2/3" )
  402.     PORT_DIPSETTING(    0xd0, "1 Coin/1 Credit 4/5" )
  403.     PORT_DIPSETTING(    0xc0, "1 Coin/1 Credit 11/12" )
  404.     PORT_DIPSETTING(    0x90, DEF_STR ( 2C_3C ) )
  405.     PORT_DIPSETTING(    0x10, DEF_STR ( 1C_2C ) )
  406.     PORT_DIPSETTING(    0xf0, "1 Coin/2 Credits 5/11" )
  407.     PORT_DIPSETTING(    0x20, DEF_STR ( 1C_3C ) )
  408.     PORT_DIPSETTING(    0x30, DEF_STR ( 1C_4C ) )
  409.     PORT_DIPSETTING(    0x40, DEF_STR ( 1C_5C ) )
  410.     PORT_DIPSETTING(    0x50, DEF_STR ( 1C_6C ) )
  411.  
  412.  
  413.     PORT_START    /* DSW0 */
  414.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet ) )
  415.     PORT_DIPSETTING(    0x01, DEF_STR( Upright ) )
  416.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  417.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
  418.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  419.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  420.     PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Lives ) )
  421.     PORT_DIPSETTING(    0x00, "3" )
  422.     PORT_DIPSETTING(    0x04, "4" )
  423.     PORT_DIPSETTING(    0x08, "5" )
  424.     PORT_BITX( 0,       0x0c, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "Infinite", IP_KEY_NONE, IP_JOY_NONE )
  425.     PORT_DIPNAME( 0x30, 0x00, DEF_STR( Bonus_Life ) )
  426.     PORT_DIPSETTING(    0x00, "20k 40k 60k" )
  427.     PORT_DIPSETTING(    0x10, "30k 60k 90k" )
  428.     PORT_DIPSETTING(    0x20, "40k 70k 100k" )
  429.     PORT_DIPSETTING(    0x30, "40k 80k 120k" )
  430.     PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Difficulty ) )
  431.     PORT_DIPSETTING(    0x00, "Easy" )
  432.     PORT_DIPSETTING(    0x40, "Medium" )
  433.     PORT_DIPSETTING(    0x80, "Hard" )
  434.     PORT_DIPSETTING(    0xc0, "Hardest" )
  435.  
  436.     PORT_START    /* FAKE */
  437.     /* This fake input port is used to get the status of the F2 key, */
  438.     /* and activate the test mode, which is triggered by a NMI */
  439.     PORT_BITX(0x01, IP_ACTIVE_HIGH, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
  440. INPUT_PORTS_END
  441.  
  442. INPUT_PORTS_START( razmataz )
  443.     PORT_START    /* IN0 */
  444.     PORT_ANALOG( 0xff, 0x00, IPT_DIAL | IPF_CENTER | IPF_PLAYER1, 30, 15, 0, 0 )
  445.  
  446.     PORT_START    /* IN1 */
  447.     PORT_ANALOG( 0xff, 0x00, IPT_DIAL | IPF_CENTER | IPF_PLAYER2 | IPF_REVERSE, 30, 15, 0, 0 )
  448.  
  449.     PORT_START    /* IN2 */
  450.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  451.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  452.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  453.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  454.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  455.     /* the coin inputs must stay active for exactly one frame, otherwise */
  456.     /* the game will keep inserting coins. */
  457.     PORT_BIT_IMPULSE( 0x20, IP_ACTIVE_HIGH, IPT_COIN1, 1 )
  458.     PORT_BIT_IMPULSE( 0x40, IP_ACTIVE_HIGH, IPT_COIN2, 1 )
  459.     PORT_BIT_IMPULSE( 0x80, IP_ACTIVE_HIGH, IPT_COIN3, 1 )
  460.  
  461.     PORT_START    /* DSW0 */
  462.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
  463.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  464.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  465.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
  466.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  467.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  468.     PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
  469.     PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
  470.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  471.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
  472.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  473.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  474.     PORT_DIPNAME( 0x30, 0x10, DEF_STR( Lives ) )
  475.     PORT_DIPSETTING(    0x00, "2" )
  476.     PORT_DIPSETTING(    0x10, "3" )
  477.     PORT_DIPSETTING(    0x20, "4" )
  478.     PORT_DIPSETTING(    0x30, "5" )
  479.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
  480.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  481.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  482.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
  483.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  484.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  485.  
  486.     PORT_START    /* DSW1 */
  487.     PORT_DIPNAME( 0x07, 0x03, DEF_STR( Coin_B ) )
  488.     PORT_DIPSETTING(    0x00, DEF_STR ( 4C_1C ) )
  489.     PORT_DIPSETTING(    0x01, DEF_STR ( 3C_1C ) )
  490.     PORT_DIPSETTING(    0x02, DEF_STR ( 2C_1C ) )
  491.     PORT_DIPSETTING(    0x03, DEF_STR ( 1C_1C ) )
  492.     PORT_DIPSETTING(    0x04, DEF_STR ( 1C_2C ) )
  493.     PORT_DIPSETTING(    0x05, DEF_STR ( 1C_3C ) )
  494.     PORT_DIPSETTING(    0x06, DEF_STR ( 1C_4C ) )
  495.     PORT_DIPSETTING(    0x07, DEF_STR ( 1C_5C ) )
  496.     PORT_DIPNAME( 0x38, 0x18, DEF_STR( Coin_A ) )
  497.     PORT_DIPSETTING(    0x00, DEF_STR ( 4C_1C ) )
  498.     PORT_DIPSETTING(    0x08, DEF_STR ( 3C_1C ) )
  499.     PORT_DIPSETTING(    0x10, DEF_STR ( 2C_1C ) )
  500.     PORT_DIPSETTING(    0x18, DEF_STR ( 1C_1C ) )
  501.     PORT_DIPSETTING(    0x20, DEF_STR ( 1C_2C ) )
  502.     PORT_DIPSETTING(    0x28, DEF_STR ( 1C_3C ) )
  503.     PORT_DIPSETTING(    0x30, DEF_STR ( 1C_4C ) )
  504.     PORT_DIPSETTING(    0x38, DEF_STR ( 1C_5C ) )
  505.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
  506.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  507.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  508.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Free_Play ) )
  509.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  510.     PORT_DIPSETTING(    0x80, DEF_STR( On ) )
  511.  
  512.     PORT_START    /* FAKE */
  513.     /* This fake input port is used to get the status of the F2 key, */
  514.     /* and activate the test mode, which is triggered by a NMI */
  515.     PORT_BITX(0x01, IP_ACTIVE_HIGH, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
  516.  
  517.     PORT_START    /* IN3 */
  518.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_PLAYER1 )
  519.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  520.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  521.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  522.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  523.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_START1 )
  524.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  525.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  526.  
  527.     PORT_START    /* IN4 */
  528.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_PLAYER2 )
  529.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  530.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  531.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  532.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  533.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_START2 )
  534.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  535.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  536. INPUT_PORTS_END
  537.  
  538.  
  539.  
  540. struct GfxLayout zaxxon_charlayout1 =
  541. {
  542.     8,8,    /* 8*8 characters */
  543.     256,    /* 256 characters */
  544.     3,    /* 3 bits per pixel (actually 2, the third plane is 0) */
  545.     { 2*256*8*8, 256*8*8, 0 },    /* the bitplanes are separated */
  546.     { 0, 1, 2, 3, 4, 5, 6, 7 },
  547.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  548.     8*8    /* every char takes 8 consecutive bytes */
  549. };
  550.  
  551. struct GfxLayout zaxxon_charlayout2 =
  552. {
  553.     8,8,    /* 8*8 characters */
  554.     1024,    /* 1024 characters */
  555.     3,    /* 3 bits per pixel */
  556.     { 2*1024*8*8, 1024*8*8, 0 },    /* the bitplanes are separated */
  557.     { 0, 1, 2, 3, 4, 5, 6, 7 },
  558.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  559.     8*8    /* every char takes 8 consecutive bytes */
  560. };
  561.  
  562. static struct GfxLayout spritelayout =
  563. {
  564.     32,32,    /* 32*32 sprites */
  565.     64,    /* 64 sprites */
  566.     3,    /* 3 bits per pixel */
  567.     { 2*64*128*8, 64*128*8, 0 },    /* the bitplanes are separated */
  568.     { 0, 1, 2, 3, 4, 5, 6, 7,
  569.             8*8+0, 8*8+1, 8*8+2, 8*8+3, 8*8+4, 8*8+5, 8*8+6, 8*8+7,
  570.             16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7,
  571.             24*8+0, 24*8+1, 24*8+2, 24*8+3, 24*8+4, 24*8+5, 24*8+6, 24*8+7 },
  572.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  573.             32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8,
  574.             64*8, 65*8, 66*8, 67*8, 68*8, 69*8, 70*8, 71*8,
  575.             96*8, 97*8, 98*8, 99*8, 100*8, 101*8, 102*8, 103*8 },
  576.     128*8    /* every sprite takes 128 consecutive bytes */
  577. };
  578.  
  579. static struct GfxLayout futspy_spritelayout =
  580. {
  581.     32,32,    /* 32*32 sprites */
  582.     128,    /* 128 sprites */
  583.     3,    /* 3 bits per pixel */
  584.     { 2*128*128*8, 128*128*8, 0 },    /* the bitplanes are separated */
  585.     { 0, 1, 2, 3, 4, 5, 6, 7,
  586.             8*8+0, 8*8+1, 8*8+2, 8*8+3, 8*8+4, 8*8+5, 8*8+6, 8*8+7,
  587.             16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7,
  588.             24*8+0, 24*8+1, 24*8+2, 24*8+3, 24*8+4, 24*8+5, 24*8+6, 24*8+7 },
  589.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  590.             32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8,
  591.             64*8, 65*8, 66*8, 67*8, 68*8, 69*8, 70*8, 71*8,
  592.             96*8, 97*8, 98*8, 99*8, 100*8, 101*8, 102*8, 103*8 },
  593.     128*8    /* every sprite takes 128 consecutive bytes */
  594. };
  595.  
  596.  
  597.  
  598. static struct GfxDecodeInfo gfxdecodeinfo[] =
  599. {
  600.     { REGION_GFX1, 0, &zaxxon_charlayout1,   0, 32 },    /* characters */
  601.     { REGION_GFX2, 0, &zaxxon_charlayout2,   0, 32 },    /* background tiles */
  602.     { REGION_GFX3, 0, &spritelayout,  0, 32 },            /* sprites */
  603.     { -1 } /* end of array */
  604. };
  605.  
  606. static struct GfxDecodeInfo futspy_gfxdecodeinfo[] =
  607. {
  608.     { REGION_GFX1, 0, &zaxxon_charlayout1,   0, 32 },    /* characters */
  609.     { REGION_GFX2, 0, &zaxxon_charlayout2,   0, 32 },    /* background tiles */
  610.     { REGION_GFX3, 0, &futspy_spritelayout,  0, 32 },    /* sprites */
  611.     { -1 } /* end of array */
  612. };
  613.  
  614.  
  615.  
  616. static const char *zaxxon_sample_names[] =
  617. {
  618.     "*zaxxon",
  619.     "03.wav",    /* Homing Missile */
  620.     "02.wav",    /* Base Missile */
  621.     "01.wav",    /* Laser (force field) */
  622.     "00.wav",    /* Battleship (end of level boss) */
  623.     "11.wav",    /* S-Exp (enemy explosion) */
  624.     "10.wav",    /* M-Exp (ship explosion) */
  625.     "08.wav",     /* Cannon (ship fire) */
  626.     "23.wav",    /* Shot (enemy fire) */
  627.     "21.wav",    /* Alarm 2 (target lock) */
  628.     "20.wav",    /* Alarm 3 (low fuel) */
  629.     "05.wav",    /* initial background noise */
  630.     "04.wav",    /* looped asteroid noise */
  631.     0
  632. };
  633.  
  634. static struct Samplesinterface zaxxon_samples_interface =
  635. {
  636.     12,    /* 12 channels */
  637.     25,    /* volume */
  638.     zaxxon_sample_names
  639. };
  640.  
  641.  
  642. static struct MachineDriver machine_driver_zaxxon =
  643. {
  644.     /* basic machine hardware */
  645.     {
  646.         {
  647.             CPU_Z80,
  648.             3072000,    /* 3.072 Mhz ?? */
  649.             readmem,writemem,0,0,
  650.             zaxxon_interrupt,1
  651.         }
  652.     },
  653.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  654.     1,    /* single CPU, no need for interleaving */
  655.     zaxxon_init_machine,
  656.  
  657.     /* video hardware */
  658.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  659.     gfxdecodeinfo,
  660.     256,32*8,
  661.     zaxxon_vh_convert_color_prom,
  662.  
  663.     VIDEO_TYPE_RASTER,
  664.     0,
  665.     zaxxon_vh_start,
  666.     zaxxon_vh_stop,
  667.     zaxxon_vh_screenrefresh,
  668.  
  669.     /* sound hardware */
  670.     0,0,0,0,
  671.     {
  672.         {
  673.             SOUND_SAMPLES,
  674.             &zaxxon_samples_interface
  675.         }
  676.     }
  677. };
  678.  
  679. static struct MachineDriver machine_driver_futspy =
  680. {
  681.     /* basic machine hardware */
  682.     {
  683.         {
  684.             CPU_Z80,
  685.             3072000,    /* 3.072 Mhz ?? */
  686.             readmem,futspy_writemem,0,0,
  687.             zaxxon_interrupt,1
  688.         }
  689.     },
  690.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  691.     1,    /* single CPU, no need for interleaving */
  692.     futspy_init_machine,
  693.  
  694.     /* video hardware */
  695.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  696.     futspy_gfxdecodeinfo,
  697.     256,32*8,
  698.     zaxxon_vh_convert_color_prom,
  699.  
  700.     VIDEO_TYPE_RASTER,
  701.     0,
  702.     zaxxon_vh_start,
  703.     zaxxon_vh_stop,
  704.     zaxxon_vh_screenrefresh,
  705.  
  706.     /* sound hardware */
  707.     0,0,0,0,
  708.     {
  709.         {
  710.             SOUND_SAMPLES,
  711.             &zaxxon_samples_interface
  712.         }
  713.     }
  714. };
  715.  
  716. static struct MachineDriver machine_driver_razmataz =
  717. {
  718.     /* basic machine hardware */
  719.     {
  720.         {
  721.             CPU_Z80,
  722.             3072000,    /* 3.072 Mhz ?? */
  723.             razmataz_readmem,razmataz_writemem,0,0,
  724.             zaxxon_interrupt,1
  725.         }
  726.     },
  727.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  728.     1,    /* single CPU, no need for interleaving */
  729.     zaxxon_init_machine,
  730.  
  731.     /* video hardware */
  732.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  733.     gfxdecodeinfo,
  734.     256,32*8,
  735.     zaxxon_vh_convert_color_prom,
  736.  
  737.     VIDEO_TYPE_RASTER,
  738.     0,
  739.     razmataz_vh_start,
  740.     zaxxon_vh_stop,
  741.     razmataz_vh_screenrefresh,
  742.  
  743.     /* sound hardware */
  744.     0,0,0,0,
  745. };
  746.  
  747.  
  748.  
  749. /***************************************************************************
  750.  
  751.   Game driver(s)
  752.  
  753. ***************************************************************************/
  754.  
  755. ROM_START( zaxxon )
  756.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  757.     ROM_LOAD( "zaxxon.3",     0x0000, 0x2000, 0x6e2b4a30 )
  758.     ROM_LOAD( "zaxxon.2",     0x2000, 0x2000, 0x1c9ea398 )
  759.     ROM_LOAD( "zaxxon.1",     0x4000, 0x1000, 0x1c123ef9 )
  760.  
  761.     ROM_REGION( 0x1800, REGION_GFX1 | REGIONFLAG_DISPOSE )
  762.     ROM_LOAD( "zaxxon.14",    0x0000, 0x0800, 0x07bf8c52 )    /* characters */
  763.     ROM_LOAD( "zaxxon.15",    0x0800, 0x0800, 0xc215edcb )
  764.     /* 1000-17ff empty space to convert the characters as 3bpp instead of 2 */
  765.  
  766.     ROM_REGION( 0x6000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  767.     ROM_LOAD( "zaxxon.6",     0x0000, 0x2000, 0x6e07bb68 )    /* background tiles */
  768.     ROM_LOAD( "zaxxon.5",     0x2000, 0x2000, 0x0a5bce6a )
  769.     ROM_LOAD( "zaxxon.4",     0x4000, 0x2000, 0xa5bf1465 )
  770.  
  771.     ROM_REGION( 0x6000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  772.     ROM_LOAD( "zaxxon.11",    0x0000, 0x2000, 0xeaf0dd4b )    /* sprites */
  773.     ROM_LOAD( "zaxxon.12",    0x2000, 0x2000, 0x1c5369c7 )
  774.     ROM_LOAD( "zaxxon.13",    0x4000, 0x2000, 0xab4e8a9a )
  775.  
  776.     ROM_REGION( 0x8000, REGION_GFX4 | REGIONFLAG_DISPOSE )    /* background tilemaps converted in vh_start */
  777.     ROM_LOAD( "zaxxon.8",     0x0000, 0x2000, 0x28d65063 )
  778.     ROM_LOAD( "zaxxon.7",     0x2000, 0x2000, 0x6284c200 )
  779.     ROM_LOAD( "zaxxon.10",    0x4000, 0x2000, 0xa95e61fd )
  780.     ROM_LOAD( "zaxxon.9",     0x6000, 0x2000, 0x7e42691f )
  781.  
  782.     ROM_REGION( 0x0200, REGION_PROMS )
  783.     ROM_LOAD( "zaxxon.u98",   0x0000, 0x0100, 0x6cc6695b ) /* palette */
  784.     ROM_LOAD( "zaxxon.u72",   0x0100, 0x0100, 0xdeaa21f7 ) /* char lookup table */
  785. ROM_END
  786.  
  787. ROM_START( zaxxon2 )
  788.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  789.     ROM_LOAD( "3a",           0x0000, 0x2000, 0xb18e428a )
  790.     ROM_LOAD( "zaxxon.2",     0x2000, 0x2000, 0x1c9ea398 )
  791.     ROM_LOAD( "1a",           0x4000, 0x1000, 0x1977d933 )
  792.  
  793.     ROM_REGION( 0x1800, REGION_GFX1 | REGIONFLAG_DISPOSE )
  794.     ROM_LOAD( "zaxxon.14",    0x0000, 0x0800, 0x07bf8c52 )    /* characters */
  795.     ROM_LOAD( "zaxxon.15",    0x0800, 0x0800, 0xc215edcb )
  796.     /* 1000-17ff empty space to convert the characters as 3bpp instead of 2 */
  797.  
  798.     ROM_REGION( 0x6000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  799.     ROM_LOAD( "zaxxon.6",     0x0000, 0x2000, 0x6e07bb68 )    /* background tiles */
  800.     ROM_LOAD( "zaxxon.5",     0x2000, 0x2000, 0x0a5bce6a )
  801.     ROM_LOAD( "zaxxon.4",     0x4000, 0x2000, 0xa5bf1465 )
  802.  
  803.     ROM_REGION( 0x6000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  804.     ROM_LOAD( "zaxxon.11",    0x0000, 0x2000, 0xeaf0dd4b )    /* sprites */
  805.     ROM_LOAD( "zaxxon.12",    0x2000, 0x2000, 0x1c5369c7 )
  806.     ROM_LOAD( "zaxxon.13",    0x4000, 0x2000, 0xab4e8a9a )
  807.  
  808.     ROM_REGION( 0x8000, REGION_GFX4 | REGIONFLAG_DISPOSE )    /* background tilemaps converted in vh_start */
  809.     ROM_LOAD( "zaxxon.8",     0x0000, 0x2000, 0x28d65063 )
  810.     ROM_LOAD( "zaxxon.7",     0x2000, 0x2000, 0x6284c200 )
  811.     ROM_LOAD( "zaxxon.10",    0x4000, 0x2000, 0xa95e61fd )
  812.     ROM_LOAD( "zaxxon.9",     0x6000, 0x2000, 0x7e42691f )
  813.  
  814.     ROM_REGION( 0x0200, REGION_PROMS )
  815.     ROM_LOAD( "zaxxon.u98",   0x0000, 0x0100, 0x6cc6695b ) /* palette */
  816.     ROM_LOAD( "j214a2.72",    0x0100, 0x0100, 0xa9e1fb43 ) /* char lookup table */
  817. ROM_END
  818.  
  819. ROM_START( zaxxonb )
  820.     ROM_REGION( 2*0x10000, REGION_CPU1 )    /* 64k for code + 64k for decrypted opcodes */
  821.     ROM_LOAD( "zaxxonb.3",    0x0000, 0x2000, 0x125bca1c )
  822.     ROM_LOAD( "zaxxonb.2",    0x2000, 0x2000, 0xc088df92 )
  823.     ROM_LOAD( "zaxxonb.1",    0x4000, 0x1000, 0xe7bdc417 )
  824.  
  825.     ROM_REGION( 0x1800, REGION_GFX1 | REGIONFLAG_DISPOSE )
  826.     ROM_LOAD( "zaxxon.14",    0x0000, 0x0800, 0x07bf8c52 )    /* characters */
  827.     ROM_LOAD( "zaxxon.15",    0x0800, 0x0800, 0xc215edcb )
  828.     /* 1000-17ff empty space to convert the characters as 3bpp instead of 2 */
  829.  
  830.     ROM_REGION( 0x6000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  831.     ROM_LOAD( "zaxxon.6",     0x0000, 0x2000, 0x6e07bb68 )    /* background tiles */
  832.     ROM_LOAD( "zaxxon.5",     0x2000, 0x2000, 0x0a5bce6a )
  833.     ROM_LOAD( "zaxxon.4",     0x4000, 0x2000, 0xa5bf1465 )
  834.  
  835.     ROM_REGION( 0x6000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  836.     ROM_LOAD( "zaxxon.11",    0x0000, 0x2000, 0xeaf0dd4b )    /* sprites */
  837.     ROM_LOAD( "zaxxon.12",    0x2000, 0x2000, 0x1c5369c7 )
  838.     ROM_LOAD( "zaxxon.13",    0x4000, 0x2000, 0xab4e8a9a )
  839.  
  840.     ROM_REGION( 0x8000, REGION_GFX4 | REGIONFLAG_DISPOSE )    /* background tilemaps converted in vh_start */
  841.     ROM_LOAD( "zaxxon.8",     0x0000, 0x2000, 0x28d65063 )
  842.     ROM_LOAD( "zaxxon.7",     0x2000, 0x2000, 0x6284c200 )
  843.     ROM_LOAD( "zaxxon.10",    0x4000, 0x2000, 0xa95e61fd )
  844.     ROM_LOAD( "zaxxon.9",     0x6000, 0x2000, 0x7e42691f )
  845.  
  846.     ROM_REGION( 0x0200, REGION_PROMS )
  847.     ROM_LOAD( "zaxxon.u98",   0x0000, 0x0100, 0x6cc6695b ) /* palette */
  848.     ROM_LOAD( "zaxxon.u72",   0x0100, 0x0100, 0xdeaa21f7 ) /* char lookup table */
  849. ROM_END
  850.  
  851. ROM_START( szaxxon )
  852.     ROM_REGION( 2*0x10000, REGION_CPU1 )    /* 64k for code + 64k for decrypted opcodes */
  853.     ROM_LOAD( "suzaxxon.3",   0x0000, 0x2000, 0xaf7221da )
  854.     ROM_LOAD( "suzaxxon.2",   0x2000, 0x2000, 0x1b90fb2a )
  855.     ROM_LOAD( "suzaxxon.1",   0x4000, 0x1000, 0x07258b4a )
  856.  
  857.     ROM_REGION( 0x1800, REGION_GFX1 | REGIONFLAG_DISPOSE )
  858.     ROM_LOAD( "suzaxxon.14",  0x0000, 0x0800, 0xbccf560c )    /* characters */
  859.     ROM_LOAD( "suzaxxon.15",  0x0800, 0x0800, 0xd28c628b )
  860.     /* 1000-17ff empty space to convert the characters as 3bpp instead of 2 */
  861.  
  862.     ROM_REGION( 0x6000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  863.     ROM_LOAD( "suzaxxon.6",   0x0000, 0x2000, 0xf51af375 )    /* background tiles */
  864.     ROM_LOAD( "suzaxxon.5",   0x2000, 0x2000, 0xa7de021d )
  865.     ROM_LOAD( "suzaxxon.4",   0x4000, 0x2000, 0x5bfb3b04 )
  866.  
  867.     ROM_REGION( 0x6000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  868.     ROM_LOAD( "suzaxxon.11",  0x0000, 0x2000, 0x1503ae41 )    /* sprites */
  869.     ROM_LOAD( "suzaxxon.12",  0x2000, 0x2000, 0x3b53d83f )
  870.     ROM_LOAD( "suzaxxon.13",  0x4000, 0x2000, 0x581e8793 )
  871.  
  872.     ROM_REGION( 0x8000, REGION_GFX4 | REGIONFLAG_DISPOSE )    /* background tilemaps converted in vh_start */
  873.     ROM_LOAD( "suzaxxon.8",   0x0000, 0x2000, 0xdd1b52df )
  874.     ROM_LOAD( "suzaxxon.7",   0x2000, 0x2000, 0xb5bc07f0 )
  875.     ROM_LOAD( "suzaxxon.10",  0x4000, 0x2000, 0x68e84174 )
  876.     ROM_LOAD( "suzaxxon.9",   0x6000, 0x2000, 0xa509994b )
  877.  
  878.     ROM_REGION( 0x0200, REGION_PROMS )
  879.     ROM_LOAD( "suzaxxon.u98", 0x0000, 0x0100, 0x15727a9f ) /* palette */
  880.     ROM_LOAD( "suzaxxon.u72", 0x0100, 0x0100, 0xdeaa21f7 ) /* char lookup table */
  881. ROM_END
  882.  
  883. ROM_START( futspy )
  884.     ROM_REGION( 2*0x10000, REGION_CPU1 )    /* 64k for code + 64k for decrypted opcodes */
  885.     ROM_LOAD( "fs_snd.u27",   0x0000, 0x2000, 0x7578fe7f )
  886.     ROM_LOAD( "fs_snd.u28",   0x2000, 0x2000, 0x8ade203c )
  887.     ROM_LOAD( "fs_snd.u29",   0x4000, 0x1000, 0x734299c3 )
  888.  
  889.     ROM_REGION( 0x1800, REGION_GFX1 | REGIONFLAG_DISPOSE )
  890.     ROM_LOAD( "fs_snd.u68",   0x0000, 0x0800, 0x305fae2d )    /* characters */
  891.     ROM_LOAD( "fs_snd.u69",   0x0800, 0x0800, 0x3c5658c0 )
  892.     /* 1000-17ff empty space to convert the characters as 3bpp instead of 2 */
  893.  
  894.     ROM_REGION( 0x6000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  895.     ROM_LOAD( "fs_vid.113",   0x0000, 0x2000, 0x36d2bdf6 )    /* background tiles */
  896.     ROM_LOAD( "fs_vid.112",   0x2000, 0x2000, 0x3740946a )
  897.     ROM_LOAD( "fs_vid.111",   0x4000, 0x2000, 0x4cd4df98 )
  898.  
  899.     ROM_REGION( 0xc000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  900.     ROM_LOAD( "fs_vid.u77",   0x0000, 0x4000, 0x1b93c9ec )    /* sprites */
  901.     ROM_LOAD( "fs_vid.u78",   0x4000, 0x4000, 0x50e55262 )
  902.     ROM_LOAD( "fs_vid.u79",   0x8000, 0x4000, 0xbfb02e3e )
  903.  
  904.     ROM_REGION( 0x8000, REGION_GFX4 | REGIONFLAG_DISPOSE )    /* background tilemaps converted in vh_start */
  905.     ROM_LOAD( "fs_vid.u91",   0x0000, 0x2000, 0x86da01f4 )
  906.     ROM_LOAD( "fs_vid.u90",   0x2000, 0x2000, 0x2bd41d2d )
  907.     ROM_LOAD( "fs_vid.u93",   0x4000, 0x2000, 0xb82b4997 )
  908.     ROM_LOAD( "fs_vid.u92",   0x6000, 0x2000, 0xaf4015af )
  909.  
  910.     ROM_REGION( 0x0200, REGION_PROMS )
  911.     ROM_LOAD( "futrprom.u98", 0x0000, 0x0100, 0x9ba2acaa ) /* palette */
  912.     ROM_LOAD( "futrprom.u72", 0x0100, 0x0100, 0xf9e26790 ) /* char lookup table */
  913. ROM_END
  914.  
  915. ROM_START( razmataz )
  916.     ROM_REGION( 2*0x10000, REGION_CPU1 )    /* 64k for code + 64k for decrypted opcodes */
  917.     ROM_LOAD( "u27",           0x0000, 0x2000, 0x254f350f )
  918.     ROM_LOAD( "u28",           0x2000, 0x2000, 0x3a1eaa99 )
  919.     ROM_LOAD( "u29",           0x4000, 0x2000, 0x0ee67e78 )
  920.  
  921.     ROM_REGION( 0x1800, REGION_GFX1 | REGIONFLAG_DISPOSE )
  922.     ROM_LOAD( "1921.u68",      0x0000, 0x0800, 0x77f8ff5a )  /* characters */
  923.     ROM_LOAD( "1922.u69",      0x0800, 0x0800, 0xcf63621e )
  924.     /* 1000-17ff empty space to convert the characters as 3bpp instead of 2 */
  925.  
  926.     ROM_REGION( 0x6000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  927.     ROM_LOAD( "1934.113",      0x0000, 0x2000, 0x39bb679c )  /* background tiles */
  928.     ROM_LOAD( "1933.112",      0x2000, 0x2000, 0x1022185e )
  929.     ROM_LOAD( "1932.111",      0x4000, 0x2000, 0xc7a715eb )
  930.  
  931.     ROM_REGION( 0x6000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  932.     ROM_LOAD( "1925.u77",      0x0000, 0x2000, 0xa7965437 )  /* sprites */
  933.     ROM_LOAD( "1926.u78",      0x2000, 0x2000, 0x9a3af434 )
  934.     ROM_LOAD( "1927.u79",      0x4000, 0x2000, 0x0323de2b )
  935.  
  936.     ROM_REGION( 0x8000, REGION_GFX4 | REGIONFLAG_DISPOSE )    /* background tilemaps converted in vh_start */
  937.     ROM_LOAD( "1929.u91",      0x0000, 0x2000, 0x55c7c757 )
  938.     ROM_LOAD( "1928.u90",      0x2000, 0x2000, 0xe58b155b )
  939.     ROM_LOAD( "1931.u93",      0x4000, 0x2000, 0x55fe0f82 )
  940.     ROM_LOAD( "1930.u92",      0x6000, 0x2000, 0xf355f105 )
  941.  
  942.     ROM_REGION( 0x0200, REGION_PROMS )
  943.     ROM_LOAD( "clr.u98",       0x0000, 0x0100, 0x0fd671af )    /* palette */
  944.     ROM_LOAD( "clr.u72",       0x0100, 0x0100, 0x03233bc5 ) /* char lookup table */
  945.  
  946.     ROM_REGION( 0x1000, REGION_SOUND1 )    /* sound? */
  947.     ROM_LOAD( "1923.u50",      0x0000, 0x0800, 0x59994a51 )
  948.     ROM_LOAD( "1924.u51",      0x0800, 0x0800, 0xa75e0011 )
  949. ROM_END
  950.  
  951.  
  952.  
  953. static void init_zaxxonb(void)
  954. {
  955. /*
  956.     the values vary, but the translation mask is always laid out like this:
  957.  
  958.       0 1 2 3 4 5 6 7 8 9 a b c d e f
  959.     0 A A B B A A B B C C D D C C D D
  960.     1 A A B B A A B B C C D D C C D D
  961.     2 E E F F E E F F G G H H G G H H
  962.     3 E E F F E E F F G G H H G G H H
  963.     4 A A B B A A B B C C D D C C D D
  964.     5 A A B B A A B B C C D D C C D D
  965.     6 E E F F E E F F G G H H G G H H
  966.     7 E E F F E E F F G G H H G G H H
  967.     8 H H G G H H G G F F E E F F E E
  968.     9 H H G G H H G G F F E E F F E E
  969.     a D D C C D D C C B B A A B B A A
  970.     b D D C C D D C C B B A A B B A A
  971.     c H H G G H H G G F F E E F F E E
  972.     d H H G G H H G G F F E E F F E E
  973.     e D D C C D D C C B B A A B B A A
  974.     f D D C C D D C C B B A A B B A A
  975.  
  976.     (e.g. 0xc0 is XORed with H)
  977.     therefore in the following tables we only keep track of A, B, C, D, E, F, G and H.
  978. */
  979.     static const unsigned char data_xortable[2][8] =
  980.     {
  981.         { 0x0a,0x0a,0x22,0x22,0xaa,0xaa,0x82,0x82 },    /* ...............0 */
  982.         { 0xa0,0xaa,0x28,0x22,0xa0,0xaa,0x28,0x22 },    /* ...............1 */
  983.     };
  984.     static const unsigned char opcode_xortable[8][8] =
  985.     {
  986.         { 0x8a,0x8a,0x02,0x02,0x8a,0x8a,0x02,0x02 },    /* .......0...0...0 */
  987.         { 0x80,0x80,0x08,0x08,0xa8,0xa8,0x20,0x20 },    /* .......0...0...1 */
  988.         { 0x8a,0x8a,0x02,0x02,0x8a,0x8a,0x02,0x02 },    /* .......0...1...0 */
  989.         { 0x02,0x08,0x2a,0x20,0x20,0x2a,0x08,0x02 },    /* .......0...1...1 */
  990.         { 0x88,0x0a,0x88,0x0a,0xaa,0x28,0xaa,0x28 },    /* .......1...0...0 */
  991.         { 0x80,0x80,0x08,0x08,0xa8,0xa8,0x20,0x20 },    /* .......1...0...1 */
  992.         { 0x88,0x0a,0x88,0x0a,0xaa,0x28,0xaa,0x28 },    /* .......1...1...0 */
  993.         { 0x02,0x08,0x2a,0x20,0x20,0x2a,0x08,0x02 }     /* .......1...1...1 */
  994.     };
  995.     int A;
  996.     unsigned char *rom = memory_region(REGION_CPU1);
  997.     int diff = memory_region_length(REGION_CPU1) / 2;
  998.  
  999.  
  1000.     memory_set_opcode_base(0,rom+diff);
  1001.  
  1002.     for (A = 0x0000;A < 0x8000;A++)
  1003.     {
  1004.         int i,j;
  1005.         unsigned char src;
  1006.  
  1007.  
  1008.         src = rom[A];
  1009.  
  1010.         /* pick the translation table from bit 0 of the address */
  1011.         i = A & 1;
  1012.  
  1013.         /* pick the offset in the table from bits 1, 3 and 5 of the source data */
  1014.         j = ((src >> 1) & 1) + (((src >> 3) & 1) << 1) + (((src >> 5) & 1) << 2);
  1015.         /* the bottom half of the translation table is the mirror image of the top */
  1016.         if (src & 0x80) j = 7 - j;
  1017.  
  1018.         /* decode the ROM data */
  1019.         rom[A] = src ^ data_xortable[i][j];
  1020.  
  1021.         /* now decode the opcodes */
  1022.         /* pick the translation table from bits 0, 4, and 8 of the address */
  1023.         i = ((A >> 0) & 1) + (((A >> 4) & 1) << 1) + (((A >> 8) & 1) << 2);
  1024.         rom[A + diff] = src ^ opcode_xortable[i][j];
  1025.     }
  1026. }
  1027.  
  1028. static void init_szaxxon(void)
  1029. {
  1030.     szaxxon_decode();
  1031. }
  1032.  
  1033. static void init_futspy(void)
  1034. {
  1035.     futspy_decode();
  1036. }
  1037.  
  1038. static void init_razmataz(void)
  1039. {
  1040.     nprinces_decode();
  1041. }
  1042.  
  1043.  
  1044. GAMEX( 1982, zaxxon,   0,      zaxxon,   zaxxon,   0,        ROT90,  "Sega",    "Zaxxon (set 1)", GAME_NO_COCKTAIL )
  1045. GAMEX( 1982, zaxxon2,  zaxxon, zaxxon,   zaxxon,   0,        ROT90,  "Sega",    "Zaxxon (set 2)", GAME_NO_COCKTAIL )
  1046. GAMEX( 1982, zaxxonb,  zaxxon, zaxxon,   zaxxon,   zaxxonb,  ROT90,  "bootleg", "Jackson", GAME_NO_COCKTAIL )
  1047. GAMEX( 1982, szaxxon,  0,      zaxxon,   zaxxon,   szaxxon,  ROT90,  "Sega",    "Super Zaxxon", GAME_NO_COCKTAIL )
  1048. GAMEX( 1984, futspy,   0,      futspy,   futspy,   futspy,   ROT270, "Sega",    "Future Spy", GAME_NO_COCKTAIL )
  1049. GAMEX( 1983, razmataz, 0,      razmataz, razmataz, razmataz, ROT270, "Sega",    "Razzmatazz", GAME_NO_SOUND | GAME_NO_COCKTAIL )
  1050.